<?php
class AboutAction extends CommonAction {

    public function index(){
        C('TOKEN_ON',false);
        //显示所有网站公告和帮助
        $ab = M('About');
        $allGonggao = $ab->field(array('id', 'title'))
                         ->where('type=1')
                         ->order('date DESC')
                         ->select();
        $allHelp = $ab->field(array('id', 'title'))
                         ->where('type=2')
                         ->order('date DESC')
                         ->select();
        $this->assign(array(
            'allgongao'=>$allGonggao,
            'allhelp'=>$allHelp
        ));
        $this->display();
    }

    public function details() {
        $id = $this->_get('id');
        if(isset($id)) {
            $about = M('About');
            $one = $about->field(array('title', 'content', 'type'))
                         ->where('id='.$id)
                         ->find();
            if($one['type'] == 1) $one['type'] = '网站公告';
            if($one['type'] == 2) $one['type'] = '网站帮助';

            parent::showAbout();

            $this->assign(array(
                'one'=>$one
            ));
            $this->display();
        }

    }


}

?>